Manages the effects available in the component. More...
Public Member Functions | |
| Effect * | createOrRetrieve (nkMemory::StringView name, EFFECT_TYPE type) |
| Effect * | record (nkMemory::StringView name, nkMemory::UniquePtr< Effect > resource) |
| Effect * | get (nkMemory::StringView name) |
| Effect * | getByIndex (unsigned int id) |
| void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
| void | erase (nkMemory::StringView name) |
| nkMemory::UniquePtr< Effect > | relinquish (nkMemory::StringView name) |
Manages the effects available in the component.
At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.
| Effect* nkAstraeus::EffectManager::createOrRetrieve | ( | nkMemory::StringView | name, |
| EFFECT_TYPE | type | ||
| ) |
Creates if unavailable, or retrieves if available, an effect.
Depending on the parameter given for the type, the Effect instance retrieved will be :
To address it fully, casting is required. For instance :
| name | The name of the effect to retrieve. |
| type | The effect type to create. |
| Effect* nkAstraeus::EffectManager::record | ( | nkMemory::StringView | name, |
| nkMemory::UniquePtr< Effect > | resource | ||
| ) |
Records an already existing resource in the manager, passing its ownership around.
| name | The name under which the resource should be recorded. |
| resource | The resource to record. |
| Effect* nkAstraeus::EffectManager::get | ( | nkMemory::StringView | name | ) |
Retrieves an effect.
| name | The name of the effect to retrieve. |
| Effect* nkAstraeus::EffectManager::getByIndex | ( | unsigned int | id | ) |
Get an effect, by index. Note that one index can map to a different effect after memory is changed. Useful to loop over all available effects in one go.
| id | The index of the effect to retrieve. |
| void nkAstraeus::EffectManager::rename | ( | nkMemory::StringView | currentName, |
| nkMemory::StringView | newName | ||
| ) |
Renames an effect.
| currentName | The name of the effect to rename. |
| newName | The name to reassign to the effect. |
| void nkAstraeus::EffectManager::erase | ( | nkMemory::StringView | name | ) |
Erases and frees an effect.
| name | The name of the effect to erase. |
| nkMemory::UniquePtr<Effect> nkAstraeus::EffectManager::relinquish | ( | nkMemory::StringView | name | ) |
Requests the manager to relinquish the ownership of a resource and pass it around.
| name | The name of the recorded resource to relinquish. |